package com.example.yiwei.crm.view.frament.contactDetailedMenu;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.yiwei.crm.R;
import com.example.yiwei.crm.data.GetContact;
import com.example.yiwei.crm.entity.ContactMessageEntity;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator on 2016/12/19.
 */

public class contactOtherFragment extends Fragment {
    TextView txt_creater,txt_updater,txt_create_time,txt_updater_time,txt_company_name,
            txt_company_phone,txt_company_address,txt_company_website,txt_additional;

ContactMessageEntity contact;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootview=inflater.inflate(R.layout.fragment_contact_detailed_other,container,false);
        txt_company_address= (TextView) rootview.findViewById(R.id.fragment_contact_other_company_address);
        txt_company_name= (TextView) rootview.findViewById(R.id.fragment_contact_other_company_name);
        txt_company_phone= (TextView) rootview.findViewById(R.id.fragment_contact_other_company_phone);
        txt_company_website= (TextView) rootview.findViewById(R.id.fragment_contact_other_company_website);
        txt_updater= (TextView) rootview.findViewById(R.id.fragment_contact_other_updater);
        txt_updater_time= (TextView) rootview.findViewById(R.id.fragment_contact_other_update_date);
        txt_creater= (TextView) rootview.findViewById(R.id.fragment_contact_other_txt_creater);
        txt_create_time= (TextView) rootview.findViewById(R.id.fragment_contact_other_create_date);
        txt_additional= (TextView) rootview.findViewById(R.id.fragment_contact_other_addtional);

        contact= GetContact.get();

        txt_creater.setText(contact.getCurrent_create_id());
        if (contact.getCreate_time()!=null){
                SimpleDateFormat sdf = new SimpleDateFormat(" yyyy-MM-dd  ");
                String create_time=contact.getCreate_time();
                long l=Long.parseLong(create_time);
                Date date = new Date(l);
                String nTime=sdf.format(date);
                txt_create_time.setText(nTime);
        }
        txt_updater.setText(contact.getCurrent_update_id());
        if (contact.getUpdate_time()!=null){
            SimpleDateFormat usdf=new SimpleDateFormat(" yyyy-MM-dd");
            String update_time=contact.getUpdate_time();
            long l=Long.parseLong(update_time);
            Date date = new Date(l);
            String nTime=usdf.format(date);
            txt_updater_time.setText(nTime);
    }
        txt_additional.setText(contact.getContact_additional());
        return rootview;
    }
}
